package com.elow.testffmpeg.Demo1;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.elow.testffmpeg.BufferUtil;
import com.elow.testffmpeg.R;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;

import javax.microedition.khronos.opengles.GL10;

public class Demo1ActivitySub extends Demo1Activity implements IOpenGLDemo {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }



    public void DrawScene(GL10 gl) {
        super.DrawScene(gl);

        float[] vertexArray = new float[]{
                -0.8f , -0.4f * 1.732f , 0.0f ,
                0.8f , -0.4f * 1.732f , 0.0f ,
                0.0f , 0.4f * 1.732f , 0.0f ,
        };
        FloatBuffer vertex = BufferUtil.fBuffer(vertexArray);

        gl.glColor4f(1.0f, 0.0f, 0.0f, 1.0f);
        gl.glPointSize(18f);
        gl.glLoadIdentity();
        gl.glTranslatef(0, 0, -4);

        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);

        gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertex);
        gl.glDrawArrays(GL10.GL_POINTS, 0, 3);

        gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);

    }

}

